package com.integralPerformance.controller;

import com.integralPerformance.common.Result;
import com.integralPerformance.pojo.entity.ServiceBase;
import com.integralPerformance.pojo.form.add.AddServiceBase;
import com.integralPerformance.pojo.form.update.UpdateServiceBase;
import com.integralPerformance.pojo.query.ServiceBaseQuery;
import com.integralPerformance.pojo.vo.BaseVo;
import com.integralPerformance.service.impl.ServiceBaseServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/s2/serviceBase")
@Tag(name = "教师公共服务积分类型的增删查改", description = "教师公共服务积分类型的增删查改")
public class ServiceBaseController {
    /**
     * curd 维护教师公共服务积分类型维护接口。
     *
     * */
    @Autowired
    ServiceBaseServiceImpl serviceBaseService;

    @Operation(summary = "查询获取 基础类型", description = "查询获取 基础类型")
    @PostMapping("/getServiceBase")
    public Result<BaseVo<ServiceBase>> getServiceBase(@RequestBody ServiceBaseQuery serviceBaseQuery) {
        return serviceBaseService.getServiceBase(serviceBaseQuery);
    }

    @Operation(summary = "修改具体类型内容", description = "修改具体类型内容")
    @PostMapping("/updateServiceBase")
    public Result<String> updateServiceBase(@RequestBody UpdateServiceBase updateServiceBase) {
        return serviceBaseService.updateServiceBase(updateServiceBase);
    }

    @Operation(summary = "添加一个公共服务积分标准", description = "添加一个公共服务积分标准")
    @PostMapping("/addServiceBase")
    public Result<String> addServiceBase(@RequestBody AddServiceBase addServiceBase) {
        return serviceBaseService.addServiceBase(addServiceBase);
    }

    @Operation(summary = "删除一个公共服务积分标准", description = "删除一个公共服务积分标准")
    @DeleteMapping("/deleteServiceBaseById/{id}")
    public Result<String> deleteServiceBaseById(@PathVariable String id) {
        return serviceBaseService.deleteServiceBaseById(id);
    }

    @Operation(summary = "删除多个公共服务积分标准", description = "删除多个公共服务积分标准")
    @DeleteMapping("/deleteServiceBaseByIds")
    public Result<String> deleteServiceBaseByIds(@RequestParam("ids") @Parameter(description = "选择删除的公共服务积分标准列表ids") List<Long> ids) {
        return serviceBaseService.deleteServiceBaseByIds(ids);
    }
}
